package com.ibeeking.found.common.enums;
/**
 * @Author ibeeking
 * @Date: 2021-01-05 19:15
 * @Description: 时间单位枚举
 */
public enum WeekUnitEnum {
    /**
     * 周
     */
    UNIT(0, "周"),
    MONDAY(1, "周一"),
    TUESDAY(2, "周二"),
    WEDNESDAY(3, "周三"),
    THURSDAY(4, "周四"),
    FRIDAY(5, "周五"),
    SATURDAY(6, "周六"),
    SUNDAY(7, "周日"),
    ;
    private Integer code;
    private String lable;

    WeekUnitEnum(int code, String lable) {
        this.code = code;
        this.lable = lable;
    }

    public Integer getCode() {
        return code;
    }

    public String getLable() {
        return lable;
    }

    public static WeekUnitEnum getEnum(Integer code) {
        for (WeekUnitEnum enumObj : values()) {
            if (enumObj.getCode().equals(code)) {
                return enumObj;
            }
        }
        return null;
    }
}
